import { defineStore } from "pinia";

const useCountStore = defineStore('count', {
    state: () => {
        return {
            name: "frank",
            age: 25,
            gender: "男",
            sum: 5,
        }
    },

    //放置 的动作函数 
    actions: {
        increment(value: number) {
            this.sum += value
        }

    },

    // 可以定义getters 类似于计算属性 
    getters:{
        bigSum(state){
            return state.sum * 10 
        },

        upperName(state){
            console.log('aaaaa',this)
            return state.name.toUpperCase()
        }
    }
})


// 导出
export default useCountStore;